package com.xm.servlet.background.commodity;

import com.xm.service.background.CommodityService;
import lombok.SneakyThrows;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 修改折扣
 * @author 康文程
 * @date 2024-1-17
 */
@WebServlet("/background/update/commodity/discount/by/id")
public class UpdateCommodityDiscountByIdServlet extends HttpServlet {
    private final CommodityService service = new CommodityService();
    @SneakyThrows
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) {
        String commodityDiscount = req.getParameter("commodityDiscount");
        String commodityId = req.getParameter("commodityId");

        resp.getWriter().print(service.
                updateCommodityDiscountById
                (Integer.parseInt(commodityId)
                ,Integer.parseInt(commodityDiscount)));
    }
}
